package com.wander.collection;

public class Person implements Comparable<Person> {
    private String name;

    public Person(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return name;
    }

    @Override
    public int compareTo(Person o) {
        if (this.name == null && o.name != null) {
            return -1;
        } else if (o.name == null && this.name != null) {
            return 1;
        } else if(this.name == null && o.name == null) {
            return 0;
        } else {
            return this.name.compareTo(o.name);
        }
    }
}
